<?php
    include_once 'connection/databaseHandler.php';
    include_once 'connection/sessionHandler.php';
    $database = new DatabaseHandler();
    $session = new SessionHandler();

    if (!$session->isLoggedIn || $session->id_role!=1) {
        header("location:index.php");
        die();
    }

    include_once 'classes/cAdmin.php';
    $thisPage = new Admin($database,$session);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Admin</title>
        <link href="style/style_general.css" rel="stylesheet" type="text/css"/>
        <link href="style/style_admin.css" rel="stylesheet" type="text/css"/>
        <link href="style/style_chat.css" rel="stylesheet" type="text/css"/>
        <link href="style/style_notif.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="script/AJAX.js"></script>
        <script type="text/javascript" src="script/chat.js"></script>
        <script type="text/javascript" src="script/notif.js"></script>
    </head>
    <body>
        <?php
            if ($session->isLoggedIn) {
                echo "<script language=javascript>initChat()</script>";
                echo "<script language=javascript>initNotif()</script>";
            }
            if (isset ($_GET['ref'])) {
                if ($_GET['ref']=="blockSuccess") {
                    echo "<script>alert('User Blocked/Unblocked!');</script>";
                }
                else if ($_GET['ref']=="resetSuccess") {
                    echo "<script>alert(\"Password Reset to 'password'!\");</script>";
                }
            }
            include 'layout/general_layout/header.php';
            $thisPage->genHeader();
            include 'layout/admin_layout/admin_content.php';
            include 'layout/general_layout/footer.php';
        ?>
    </body>
</html>